package cn.hx.malluser.controller;

import cn.hx.malluser.entity.UmsMember;
import cn.hx.malluser.feignApi.GoodsClient;
import cn.hx.malluser.feignApi.OrderClient;
import cn.hx.malluser.service.UmsMemberService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class PublicController {

    @Autowired
    private OrderClient orderClient;

    @Autowired
    private GoodsClient goodsClient;

    @GetMapping("/{pageName}")
    public String page(@PathVariable String pageName) { return pageName; }


    @GetMapping("/test111")
    @ResponseBody
    public String read() {
        return "11111";
    }


    /** 用户查询自己的订单列表 */
    @GetMapping("/user/myOrders/{id}")
    public String myOrders(@PathVariable("id") Long id) {
        orderClient.myOrders(id);
        return "";
    }


    /** 个人中心新品推荐 */
    @GetMapping("/latest")
    @ResponseBody
    public List<Object> latest() {
        List<Object> latest = goodsClient.latest();
        System.out.println(latest);
        return latest;
    }

}
